/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package rpg;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author Emmanouil Samatas
 */
public class GameCoreEngine {

    public static final String STRENGTH = "Strength";
    public static final String VITALITY = "Vitality";
    public static final String INTELLIGENCE = "Intelligence";
    public static final int BOSS_MULTIPLIER = 2;
    public static final int BOSS_XP_MULTIPLIER = 2;
    public static final int MAX_NUMBER_OF_CREEPS = 3;
    private static int LEVELMULTIPLIER = 10;
    private static final Map<String, Integer> baseAttributes;
    public static final Map<String, Integer> heroBaseAttributes;

    static {
        Map<String, Integer> tempMap = new HashMap<>();
        tempMap.put(STRENGTH, 13);
        tempMap.put(VITALITY, 12);
        tempMap.put(INTELLIGENCE, 10);
        baseAttributes = Collections.unmodifiableMap(tempMap);
    }
    
      static {
        Map<String, Integer> tempMap = new HashMap<>();
        tempMap.put(STRENGTH, 20);
        tempMap.put(VITALITY, 25);
        tempMap.put(INTELLIGENCE, 10);
        heroBaseAttributes = Collections.unmodifiableMap(tempMap);
    }
    

    public static Map<String, Integer> calculateAttributes(int level) {
        Map<String, Integer> attributes = new HashMap<>();
        int strength = baseAttributes.get(STRENGTH);
        int vitality = baseAttributes.get(VITALITY);
        int intelligence = baseAttributes.get(INTELLIGENCE);

        for (int i = 0; i <= level; i++) {
            strength += (LEVELMULTIPLIER * strength) / 100;
            vitality += (LEVELMULTIPLIER * vitality) / 100;
            intelligence += (LEVELMULTIPLIER * intelligence) / 100;

        }
        attributes.put(STRENGTH, strength);
        attributes.put(VITALITY, vitality);
        attributes.put(INTELLIGENCE, intelligence);
        return attributes;
    }
    


    public static int calculateHealth(int vitality) {
        return vitality * 10;
    }

    public static int calculateMana(int intelligence) {
        return intelligence * 5;
    }

    public static int calculateDamage(int strength, Weapon weapon) {
        int damage = strength * 3;
        if (weapon != null) {
            damage += weapon.getAttackBonus();
        }

        return damage;
    }

    public static int calculateDefence(int strength, List<Item> armor) {
        return strength * 5;
    }

    public static int calculateExperience(int level, int hp) {

        return hp;
    }

    //NOT IMPLEMENTED YET
    public static int calculateDamage(int damage, int defence) {
        double ratio = (double) damage/defence;
        int damageDealt = (int) (ratio * damage);
        System.out.println(damageDealt);
        return damageDealt;
    }
    

}
